package bimvu.lab1;

import android.app.Activity;
import android.os.Bundle;
import android.view.Menu;
import android.view.MenuItem;
import android.view.View;
import android.widget.TextView;

import bimvu.lab1.R;

public class SecondActivity extends Activity {

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_second);
        updateTransitionsCounter();
    }

    private void updateTransitionsCounter()
    {
        TransitionsCounter counter = TransitionsCounter.getInstance();
        counter.increment();
        View counterLayout = findViewById(R.id.include3);
        View counterView = counterLayout.findViewById(R.id.transitionsCount);
        ((TextView) counterView).setText(counter.getValue().toString());
    }

    public void handleGoBack(View target)
    {
        switch (target.getId()) {
            case R.id.buttonBack:
                setResult(RESULT_OK, null);
                finish();
                break;
            default:
                finish();
                break;
        }
    }
}
